import Vue from 'vue'
import VueRouter from 'vue-router'
import homepage from '@/views/conponents/home_page.vue'
import userpage from '@/views/conponents/Userpage.vue'
import managepage from '@/views/conponents/Managepage.vue'
import user from '@/views/conponents/User'
import manageinfo from '@/views/conponents/ManageInfo.vue'
import bookdata from '@/views/conponents/Bookdata'
import borrowdata from '@/views/conponents/Borrowdata'
import mbookdata from '@/views/conponents/MBookData'
import usersmanage from '@/views/conponents/usersManage'
import bookview from '@/views/conponents/BookView'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/Home'
  },
  {
    path: '/Home',
    name: 'Home',
    redirect: '/Home/homepage',
    component: () => import('../views/Home.vue'),
    children: [
      {
        name: 'homepage',
        path: '/Home/homepage',
        component: homepage
      },
      {
        name: 'userpage',
        path: '/Home/userpage',
        component: userpage
      },
      {
        name: 'managepage',
        path: '/Home/managepage',
        component: managepage
      },
      {
        name: 'user',
        path: 'user',
        component: user,
        children: [
          {
            name: 'bookdata',
            path: 'bookdata',
            component: bookdata
          },
          {
            path: 'borrowdata',
            name: 'borrowdata',
            component: borrowdata
          }
        ],
        props: true
      },
      {
        name: 'manageinfo',
        path: 'manageinfo',
        component: manageinfo,
        children: [
          {
            path: 'mbookdata',
            name: 'mbookdata',
            component: mbookdata
          },
          {
            name: 'usersmanage',
            path: 'usersmanage',
            component: usersmanage
          },
          {
            path: 'bookview',
            name: 'bookview',
            component: bookview
          }
        ]
      }
    ]
  }
]
const router = new VueRouter({
  routes
})

export default router
